import React, { Component } from "react"
import {
  // BrowserRouter as Router,
  Router,
  Switch,
  Route,
  Link
} from "react-router-dom"
import FastClick from 'fastclick'
import { createBrowserHistory } from "history"
import PageContainer from './components/pageContainer';
import Home from './view/home'
import TotalQuantity from './view/totalQuantity'
import CarTime from './view/carTime'
import WorkTime from './view/workTime'
import TotalOil from './view/totalOil'
import CarOil from './view/carOil'
import CarDetail from './view/carDetail'
import Login from './view/login'
import Register from './view/register'
import ForgetPwd from './view/forgetPwd'
import BindEquip from './view/bindEquip'
import MyEquip from './view/myEquip'
import ProjectList from './view/projectList'
import ProjectDetail from './view/projectDetail'
import Statistics from './view/statistics'
import CarList from './view/carList'
import DevPortrait from './view/devPortrait'
import Alarm from './view/alarm'

import './app.css'
const history = createBrowserHistory();

class RouterConfig extends Component{

  componentDidMount(){
    try {
      FastClick.attach(document.body, options);
      window.alert = function(name){
        var iframe = document.createElement("IFRAME");
        iframe.style.display="none";
        iframe.setAttribute("src", 'data:text/plain');
        document.documentElement.appendChild(iframe);
        window.frames[0].window.alert(name);
        iframe.parentNode.removeChild(iframe);
      }
    } catch (error) {
      
    }
  }

  render(){
    return(
      <Router history={history}>
        <PageContainer>
          <Switch>
            <Route exact path="/">
              <Home />
            </Route>
            <Route exact path="/alarm">
              <Alarm />
            </Route>
            <Route exact path="/totalquanitity">
              <TotalQuantity />
            </Route>
            <Route exact path="/cartime">
              <CarTime />
            </Route>
            <Route exact path="/worktime">
              <WorkTime />
            </Route>
            <Route exact path="/totaloil">
              <TotalOil />
            </Route>
            <Route exact path="/caroil">
              <CarOil />
            </Route>
            <Route exact path="/cardetail">
              <CarDetail />
            </Route>
            <Route exact path="/login">
              <Login />
            </Route>
            <Route exact path="/register">
              <Register />
            </Route>
            <Route exact path="/forgetpwd">
              <ForgetPwd />
            </Route>
            <Route exact path="/bindequip">
              <BindEquip />
            </Route>
            <Route exact path="/myequip">
              <MyEquip />
            </Route>
            <Route exact path="/projectlist">
              <ProjectList />
            </Route>
            <Route exact path="/projectdetail">
              <ProjectDetail />
            </Route>
            <Route exact path="/statistics">
              <Statistics />
            </Route>
            <Route exact path="/carList">
              <CarList />
            </Route>
            <Route exact path="/devportrait">
              <DevPortrait />
            </Route>
          </Switch>
        </PageContainer>
      </Router>
    );
  }

}

export default RouterConfig;